using System;
using System.Collections;
using System.Collections.Specialized;

using Actions;

namespace Actions.Databases
{
	/// <summary>
	/// Transaction - SQL-queries set.
	/// </summary>
	public class Transaction
	{
		private ArrayList		_queries = null;
		
		public ArrayList		queries
		{
			get
			{
				return	_queries;
			}
		}
				
		public Transaction()
		{
			_queries = new ArrayList();
		}

		public Transaction(string q)
		{
			_queries = new ArrayList();
			_queries.Add(q);
		}
		
		public void addQuery(string q)
		{
			_queries.Add(q);
		}
		
		public void appendTransaction(Transaction t)
		{
			IEnumerator i = t._queries.GetEnumerator();
			
			while(i.MoveNext()) {
				_queries.Add(i.Current);				
			}
		}
		
		public static Transaction operator +(Transaction t1, Transaction t2)
		{
			t1.appendTransaction(t2);
			return t1;
		}	
	}
}
